<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <link rel="stylesheet" href="${pageContext.request.contextPath }/css/info-mgt.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath }/css/base.css" />
	<link rel="stylesheet" href="${pageContext.request.contextPath }/css/info-reg.css" />
	<link rel="stylesheet" href="${pageContext.request.contextPath }/css/WdatePicker.css" />
    <title>进行中项目界面</title>
    <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.js"></script>
    <style type="text/css">
    	.article .title{ line-height:33px; background:url(${pageContext.request.contextPath }/images/righttitlebig.png) repeat-x; border:1px solid #c1d3de; overflow:visible;}
        .article .title h2{ margin-left:7px; padding-left:22px; font-weight:bold; font-size:14px; font-family:'瀹嬩綋'; color:#000000; background:url(${pageContext.request.contextPath }/images/titleico.png) no-repeat left center;}
    	table tr .num{ width:43px; text-align: center;}
		table tr .proId{ width:48px; padding-left: 15px;}
		table tr .proName{ width:140px;padding-left: 69px;}
		table tr .proType{ width:60px;padding-left: 25px;}
		table tr .proCash{ width:75px; padding-left: 28px;}
		table tr .proProcess{ width:100px; padding-left: 39px;}
		table tr .proDetail{ width:150px; padding-left: 65px;}
		table tr .proStart{ width:90px; padding-left: 35px;}
		table tr .proEnd{ width:60px; padding-left: 15px;}
		table tr .operate{ width:129px; text-align: center;}
		table tr .operate a{ color:#2c7bbc;}
		table tr .operate a:hover{ text-decoration:underline;}
		#tablebody .cs{ text-align: center;}
		.oper_div input{ height: 30px; margin-top: 15px; margin-left: 20px;background-color: #cba; }
		.oper_div{background-color: #cca }
		.skip_div tr td{ width: 80px; text-align: center;}
		.oper_div .query-btn{margin-left: 400px;}
		
    </style>
    <script type="text/javascript">
    	function skipPage(currentPage){
        var url='${pageContext.request.contextPath }/projectManage.action?method=queryIngProject&currPage='+currentPage;
        url+='&proName='+document.getElementById("proName").value;
        url+='&proType='+document.getElementById("proType").value;
        window.location.href=url;
      }
      
      function delProduct(tdObj){
      	 if($('#id_dept').val()=="研发部"&&$('#id_work').val()=="经理"){
      	 	if(window.confirm("确定要删除该项目吗(不可更改)?")){
 				alert("删除成功！");
 				//trObj.innerHTML=' ';
 				var url='${pageContext.request.contextPath}/projectManage.action?method=removeProject&id='+tdObj;
 				window.location.href=url;
 			}
      	 }
      	 else{
      	 	alert("没有该权限操作，请联系管理员！");
      	 }
      }
      function updateProcess(proId){
      	//alert(proId);
      	if($('#id_dept').val()=="研发部"&&$('#id_work').val()=="经理"){
      		var dd = document.getElementById("id_process").innerHTML;
      	//var exetime = document.getElementById("id_proEnd").innerHTML;
      		var process=window.showModalDialog("${pageContext.request.contextPath}/lxp/projectManage/addprocess.jsp","",
				"dialogHeight:250px;dialogWidth:350px;dialogTop:250px;dialogLeft:600px;");
      		if(process!=false&&undefined!=process){
					//得到process文本框里的数据
				dd=process;
				if(process==100){
					alert("请到已完成项目中查看！");
					var url='${pageContext.request.contextPath}/projectManage.action?method=updateProProcess&id='+proId;
 					window.location.href=url;
				}else{
				//alert(dd);
					var url='${pageContext.request.contextPath}/projectManage.action?method=updateProjectProcess&process='+dd+'&id='+proId;
 					window.location.href=url;
 				}	
 				
			}
      	}else{
      		alert("没有该权限操作，请联系管理员！");
      	}
      	
      }
      var oldColor;
      function choice(trObj){
        oldColor=trObj.bgColor;
      	trObj.bgColor = "skyblue";
      }
      function leave(trObj){
      	trObj.bgColor=oldColor;
      }
      //$('#proType option[@selected]').text();
    </script>
  </head>
  
  <body>
  	<div class="title">
    	<h2>进行中项目</h2>
    </div>
     <input type="hidden" value="${lwgKing.deptName}" id="id_dept"/>
     <input type="hidden" value="${lwgKing.empWork}" id="id_work"/>
    <form method="post" action="${pageContext.request.contextPath }/projectManage.action?method=queryIngProject">
    <div class="query"  style="background-color: #cca">
			<div class="query-conditions ue-clear">
				<div class="conditions name ue-clear">
		    		<label>项目名称：</label>
		    		<input type="text" name="proName" id="proName" value="${requestScope.search.proName }"/>
		    	</div>
        		<div class="conditions name ue-clear">
            		<label>项目类型：</label>
           			 <select name="proType" id="proType" style="width:150px; height: 30px;">
           			 
           			 	<option selected="selected" value="${requestScope.search.proType }">${requestScope.search.proType }</option>
            			<option value="">不限</option>
            		
            			<option value="公司内部">公司内部</option>
            			<option value="外部">外部</option>
            		 </select>
        		</div>
        		<div class="query-btn ue-clear">
    				
    				<input type="submit" value="查询" style="border-style: none; width: 80px; height: 40px; margin-left: 0px; background-color: green; color: white;"/>
    			</div>
    </div>	
    </div>
    </form>
    
    <div class="operate">
    	<table>
    	<thead>
        	<tr>
        		<th class="num" id="id_num">序号</th>
            	<th class="proId" id="id_proId">项目编号</th>
            	<th class="proName" id="id_proName">项目名称</th>
                <th class="proType" id="id_proType">项目类型</th>
                <th class="proCash" id="id_proCash">项目资金</th>
                <th class="proProcess" id="id_proProcess">项目进程</th>
                <th class="proDetail" id="id_proDetail">项目详情</th>
                <th class="proStart" id="id_proStart">开始时间</th>
                <th class="proEnd" id="id_proEnd">结束时间</th>
                <th class="operate" id="id_operate" colspan="2">操作</th>
            </tr>
        </thead>
        <tbody id="tablebody">
        	<c:forEach items="${requestScope.project.data_Ing}" var="pro" varStatus="c">
        		<tr onmouseover="choice(this);" onmouseout="leave(this);">
        			<td class="cs">${pro.no }</td>
        			<td class="cs">${pro.proID }</td>
        			<td class="cs">${pro.proName }</td>
        			<td class="cs">${pro.proType }</td>
        			<td class="cs">${pro.proCash }</td>
        			<td class="cs" id="id_process" style="padding: 5px 0px;">
        			<div id="id_percent" style="height:100%; width:${pro.proProcess }%; background: green;">${pro.proProcess }%</div>
        			</td> 
        			<td class="cs"><a href="file/file_finance/${pro.proDetail }">${pro.proFilename }</a></td>
        			<td class="cs">${pro.proStart }</td>
        			<td class="cs">${pro.proFinish }</td>
        			<td class="cs"><a style="color: blue;" onclick="updateProcess('${pro.proID}');">更新</a></td>
        			<td class="cs"><a style="color: blue;" onclick="delProduct('${pro.proID}');">删除</a></td>
        		</tr>
        	</c:forEach>
        </tbody>
    </table>
    </div>
    <div style="position: absolute;left:700px;bottom: 30px;">
    	<table width="80%" cellspacing="0" cellpadding="0" class="skip_div">
     	<tr>
     		<td><a onclick="skipPage('1');">首页</a></td>
     		<td><a onclick="skipPage('${requestScope.project.currentPage==1?1:requestScope.project.currentPage-1 }');">上一页</a></td>
     		<td><a onclick="skipPage('${requestScope.project.currentPage==requestScope.project.totalPage?(requestScope.project.currentPage):(requestScope.project.currentPage+1) }');">下一页</a></td>
     		<td><a onclick="skipPage('${requestScope.project.totalPage}');">末页</a></td>
     		<td>当前页码：${requestScope.project.currentPage }/${requestScope.project.totalPage}</td>
     	</tr>
     </table>
    </div>
  </body>
</html>
